<template>
  <a-card :bordered="false" class="card-area">
    <!-- 查询区域 11111-->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" :label-col="labelCol" @keyup.enter.native="searchQuery">

      </a-form>
    </div>

    <!-- 操作按钮区域 -->
    <div class="table-operator">
    </div>

    <!-- table区域-begin -->
    <div>


      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :scroll="{x: 1500}"
        @change="handleTableChange">


        <template slot="avatarslot" slot-scope="text, record, index">
          <div class="anty-img-wrap">
            <a-avatar shape="square" :src="getAvatarView(record.avatar)" icon="user" />
          </div>
        </template>
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>
<!--          <a-divider type="vertical" />-->
<!--          <a @click="handleEdit(record)">二维码</a>-->
          <a-divider type="vertical" />
          <a @click="handleModifyPwd(record)">设置</a>
        </span>

      </a-table>
    </div>
    <!-- table区域-end -->
    <!-- 表单区域 -->
    <ordStoreInfoModal ref="modalForm" @ok="modalFormOk"></ordStoreInfoModal>
    <ord-store-info-setup-modal ref="modalModifyPwdForm" @ok="modalFormOk"></ord-store-info-setup-modal>
  </a-card>
</template>
<script>
import '@/assets/less/TableExpand.less'
 import ordStoreInfoModal from './modules/StoreInfoModal'
import OrdStoreInfoSetupModal from './modules/StoreInfoSetupModal'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { putAction, getAction, postAction, getFileAccessHttpUrl } from '@/api/manage'
import { frozenBatch } from '@/api/api'

export default {
  name: 'ord_store_infoList',
  mixins: [JeecgListMixin],
  components: {
     ordStoreInfoModal,
    OrdStoreInfoSetupModal
  },
  data() {
    return {
      description: '门店管理页面',
      labelCol: { style: { width: '110px' } },
      // 表头
      columns: [
        {
          title: '店铺编码',
          align: 'center',
          dataIndex: 'storeCode',
          width: 160,
        },
        {
          title: '店铺名称',
          align: 'center',
          dataIndex: 'storeName',
          width: 160,
        },
        {
          title: '门脸图',
          align: 'center',
          dataIndex: 'avatar',
          scopedSlots: { customRender: 'avatarslot' },
          width: 130,
        },
        {
          title: '状态',
          align: 'center',
          dataIndex: 'status',
          customRender: (text, record, index) => {
            if (text == '1') {
              return '开启'
            } else {
              return '禁止'
            }
          },
          width: 100,
        },
        {
          title: '联系人',
          align: 'center',
          dataIndex: 'adminName',
          width: 130,
        },
        {
          title: '联系手机',
          align: 'center',
          dataIndex: 'phone',
          width: 130,
        },
        {
          title: '总金额(元)',
          align: 'center',
          dataIndex: 'totalAmount',
          width: 130,
        },
        {
          title: '已提现(元)',
          align: 'center',
          dataIndex: 'finishTakeAmount',
          width: 130,
        },
        {
          title: '待提现(元)',
          align: 'center',
          dataIndex: 'waitTakeAmount',
          width: 130,
        },
        {
          title: '添加时间',
          align: 'center',
          dataIndex: 'createTime',
          width: 160,
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          scopedSlots: { customRender: 'action' },
          width: 150,
        }
      ],
      url: {
        list: '/store/info/list',
        delete: '/store/info/delete'
      }
    }
  },
  computed: {},
  methods: {
    getAvatarView: function(avatar) {
      return getFileAccessHttpUrl(avatar)
    },
    handleModifyPwd: function(record) {
      this.$refs.modalModifyPwdForm.edit(record)
      this.$refs.modalModifyPwdForm.disableSubmit = false
    }
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>
